package com.veo.service.Impl;

import com.veo.dao.BookDao;
import com.veo.entity.Books;
import com.veo.entity.BorrowBooks;
import com.veo.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate5.support.HibernateDaoSupport;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service("bookService")
@Transactional()
public class BookServiceImpl extends HibernateDaoSupport implements BookService {

    @Autowired
    private BookDao bookDao;

    @Override
    public List<Books> getAllBooksToTable() {
        return bookDao.getAllBooksToTable();
    }

    @Override
    public List<BorrowBooks> getUserBorrowBooks(String id) {
        return bookDao.getUserBorrowBooks(id);
    }

    @Override
    public void deleteBook(Books books) {
         bookDao.deleteBooks(books);
    }

    @Override
    public void addBook(Books books) {
        bookDao.addBook(books);
    }

    @Override
    public void updateBook(Books books) {
        bookDao.updateBook(books);
    }
}
